import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/index'

Vue.use(Router)

export const constantRouterMap = [
  { path: '/login',
    meta: { title: '登录', noCache: true },
    component: () => import('@/views/login'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/features/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/features/401'),
    hidden: true
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: () => import('@/views/features/redirect')
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/home'),
        name: 'Dashboard',
        meta: { title: '首页', icon: 'index', affix: true, noCache: true }
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'center',
        component: () => import('@/views/system/platform/user/module/center'),
        name: '个人中心',
        meta: { title: '个人中心' }
      }
    ]
  },
  {
    path: '/hospital',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/hospital'),
        name: '医院管理',
        meta: { title: '医院管理', icon: 'index' }
      },
      {
        path: 'building/:hospitalId',
        component: () => import('@/views/business/bed/building'),
        hidden: true,
        name: '楼宇管理',
        meta: { title: '楼宇管理', icon: 'index' }
      },
      {
        path: 'depart/:hospitalId',
        component: () => import('@/views/business/bed/depart'),
        hidden: true,
        name: '科室管理',
        meta: { title: '科室管理', icon: 'index' }
      },
      {
        path: 'price/:hospitalId',
        component: () => import('@/views/business/bed/price'),
        hidden: true,
        name: '定价管理',
        meta: { title: '定价管理', icon: 'index' }
      },
      {
        path: 'rule/:hospitalId',
        component: () => import('@/views/business/bed/renttime'),
        hidden: true,
        name: '租赁规则',
        meta: { title: '租赁规则', icon: 'index' }
      },
      {
        path: 'statics/:hospitalId',
        component: () => import('@/views/business/bed/statics/hospital'),
        hidden: true,
        name: '医院统计',
        meta: { title: '医院统计', icon: 'index' }
      }
    ]
  },
  {
    path: '/device',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/device'),
        name: '设备维护',
        meta: { title: '设备维护', icon: 'index' }
      }
    ]
  },
  {
    path: '/deposit',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/deposit'),
        name: '押金维护',
        meta: { title: '押金维护', icon: 'index' }
      }
    ]
  },
  {
    path: '/rentuser',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/rentuser'),
        name: '租户管理',
        meta: { title: '租户管理', icon: 'index' }
      }
    ]
  },
  {
    path: '/order',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/order'),
        name: '订单流水',
        meta: { title: '订单流水', icon: 'index' }
      }
    ]
  },
  {
    path: '/pay',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/pay'),
        name: '资金流水',
        meta: { title: '资金流水', icon: 'index' }
      }
    ]
  },
  {
    path: '/push',
    component: Layout,
    redirect: 'noredirect',
    children: [
      {
        path: 'list',
        component: () => import('@/views/business/bed/push'),
        name: '消息流水',
        meta: { title: '消息流水', icon: 'index' }
      }
    ]
  }
]

export default new Router({
  // mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
